package com.student.school.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class BaseExceptionHandler {

    public ModelAndView error(Exception e){

        ModelAndView mv = new ModelAndView();
        e.printStackTrace();

        mv.addObject("message", e.getMessage());

        mv.setViewName("error");

        return mv;
    }

}
